﻿using System.Collections.Generic;
using Sustainalytics.Entities.RiskRatings;
using Sustainalytics.DataLayer;
using Sustainalytics.DataLayer.RiskRatings;

namespace Sustainalytics.RiskRatings.BusinessLogic.CompanySearch
{
    public class CompanySearchLogic : ICompanySearchLogic
    {
        private readonly IRiskResearchProfileRepository _profileRepository;

        public CompanySearchLogic(IRiskResearchProfileRepository profileRepository)
        {
            _profileRepository = profileRepository;
        }

        public long GetCompanyCount(RiskRatingListFilters filters)
        {
            return _profileRepository.ReadProfileCount(filters);
        }

        public IEnumerable<RiskRatingResearchProfile> FindCompanies(RiskRatingListFilters filters, int skip = 0, int take = 100, bool orderAscending = true, string orderBy = "CompanyName")
        {
            return _profileRepository.ReadProfiles(filters, skip, take, orderAscending, orderBy);
        }      
    }
}
